package org.feiye.studyday25;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.LinkedList;
import java.util.List;

import org.feiye.studyday21.prictice.Student;

public class XuliehuaTest {

	public static void main(String[] args) {
		// 序列化对象集合
		List<Student> list = new LinkedList<>();
		for (int i = 1; i <= 10; i++) {
			list.add(new Student("叶飞" + i, "男" + i, 18 + i));
		}
		ObjectOutputStream o = null;
		try {
			o = new ObjectOutputStream(new FileOutputStream("F:\\叶飞io测试\\obj.txt"));
			o.writeObject(list);
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (o != null)
				try {
					o.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
		}
	}

}
